package dao.impl;

import dao.ProvinceTop3Dao;
import domain.BlackList;
import domain.ProvinceTop3;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import util.JDBCUtils;

import java.util.List;

public class ProvinceTop3DaoImpl implements ProvinceTop3Dao {
    private JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());
    @Override
    public List<ProvinceTop3> SelectTop3ByProvince() {
        String sql = "SELECT province,adid,clickCount FROM ad_province_top3 GROUP BY province,adid";
        List<ProvinceTop3> query = template.query(sql, new BeanPropertyRowMapper<ProvinceTop3>(ProvinceTop3.class));
        return query;
    }
}
